package lesson02;

public class Demo_204 {
    //中断线程方法一
    static  boolean det=false;
    public static void main(String[] args) throws InterruptedException {
        Thread  thread=new Thread(()->{
            while (!det){
                System.out.println("hhh");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("no");
        });
        thread.start();
        thread.isAlive();
        Thread.sleep(5000);
        det=true;
    }
}
